<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>校园二手书交易平台</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <style>
        .navbar-nav .nav-item {
            margin-right: 15px;
        }
        .jumbotron {
            background-color: #f8f9fa;
            padding: 4rem 2rem;
            margin-bottom: 2rem;
            border-radius: .3rem;
        }
        .feature-icon {
            font-size: 2rem;
            margin-bottom: 1rem;
            color: #28a745;
        }
        .footer {
            background-color: #343a40;
            color: white;
            padding: 30px 0;
            margin-top: 50px;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" th:href="@{/}">
                <i class="fas fa-book-open"></i> 校园二手书交易平台
            </a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/}">
                            <i class="fas fa-home"></i> 首页
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/book/list}">
                            <i class="fas fa-list"></i> 书籍列表
                        </a>
                    </li>
                    <li class="nav-item" sec:authorize="isAuthenticated()">
                        <a class="nav-link" th:href="@{/book/my-books}">
                            <i class="fas fa-book"></i> 我的书籍
                        </a>
                    </li>
                    <li class="nav-item" sec:authorize="isAuthenticated()">
                        <a class="nav-link" th:href="@{/order/my-orders}">
                            <i class="fas fa-shopping-cart"></i> 我的订单
                        </a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item" sec:authorize="!isAuthenticated()">
                        <a class="nav-link" th:href="@{/login}">
                            <i class="fas fa-sign-in-alt"></i> 登录
                        </a>
                    </li>
                    <li class="nav-item dropdown" sec:authorize="isAuthenticated()">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown">
                            <i class="fas fa-user"></i> <span sec:authentication="name"></span>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right">
                            <a class="dropdown-item" th:href="@{/user/profile}">
                                <i class="fas fa-id-card"></i> 个人信息
                            </a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" th:href="@{/logout}">
                                <i class="fas fa-sign-out-alt"></i> 退出登录
                            </a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <div class="container py-5">
        <div class="text-center mb-5">
            <h1 class="display-4">校园二手书交易平台</h1>
            <p class="lead">让闲置图书流动起来，让知识价值延续</p>
        </div>

        <div class="row justify-content-center mb-5">
            <div class="col-md-6">
                <div class="d-flex justify-content-center">
                    <a th:href="@{/book/list}" class="btn btn-success btn-lg mx-2">
                        <i class="fas fa-search"></i> 浏览书籍
                    </a>
                    <a th:href="@{/book/publish}" class="btn btn-outline-success btn-lg mx-2" sec:authorize="isAuthenticated()">
                        <i class="fas fa-plus"></i> 发布书籍
                    </a>
                </div>
            </div>
        </div>

        <!-- 平台特色 -->
        <div class="row mt-5">
            <div class="col-md-4 text-center mb-4">
                <div class="feature-icon">
                    <i class="fas fa-hand-holding-usd"></i>
                </div>
                <h3>价格实惠</h3>
                <p>二手书籍价格优惠，为您节省学习成本</p>
            </div>
            <div class="col-md-4 text-center mb-4">
                <div class="feature-icon">
                    <i class="fas fa-shield-alt"></i>
                </div>
                <h3>安全可靠</h3>
                <p>校园内交易，买卖双方身份可靠</p>
            </div>
            <div class="col-md-4 text-center mb-4">
                <div class="feature-icon">
                    <i class="fas fa-sync-alt"></i>
                </div>
                <h3>循环利用</h3>
                <p>促进资源循环利用，保护环境</p>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer th:replace="fragments/footer :: footer"></footer>

    <!-- JavaScript引用 -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script>
</body>
</html> 